<template>
  <div>
    <el-input id="textarea" ref="textarea" type="textarea" v-model="msg" readonly rows="20" resize="none"></el-input>
  </div>
</template>

<script>
const { ipcRenderer } = require("electron");

export default {
  data() {
    return {
      msg: "hello",
    };
  },
  methods: {},
  created() {
    ipcRenderer.on("serial-message", (event, arg) => {
      this.msg += arg;
      // console.log(this.$refs.textarea);
      // this.$refs.textarea.scrollTop = this.$refs.textarea.scrollHeight;
      document.getElementById("textarea").scrollTop = document.getElementById("textarea").scrollHeight;
    });
  },
};
</script>

<style>
</style>